package com.li.algorithm.leetcode.hot100;


import java.util.ArrayList;
import java.util.List;

public class Test36 {
    ArrayList<Integer> result = new ArrayList<>();
    public List<Integer> inorderTraversal(TreeNode root) {
        //左根右
        //递归查询，左、根、右
        if (root == null) {
            return result;
        }
        inorderTraversal(root.left);
        result.add(root.val);
        inorderTraversal(root.right);
        return result;
    }
    public static void main(String[] args) {
        Test36 test36 = new Test36();
        TreeNode node1 = new TreeNode(1);
        TreeNode node2 = new TreeNode(2);
        node1.right = node2;
        TreeNode node3 = new TreeNode(3);
        node2.left = node3;
        List<Integer> result = test36.inorderTraversal(node1);
        System.out.println(result);

    }
}
